home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / rhythmbox / plugins / rb / __init__.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  3.9 KB  |  108 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. import os.path as os
  6. import os
  7. import gtk
  8. from Loader import Loader
  9. from Loader import ChunkLoader
  10. from Loader import UpdateCheck
  11. from Coroutine import Coroutine
  12.  
  13. def try_load_icon(theme, icon, size, flags):
  14.     
  15.     try:
  16.         return theme.load_icon(icon, size, flags)
  17.     except:
  18.         return None
  19.  
  20.  
  21.  
  22. def append_plugin_source_path(theme, iconpath):
  23.     fr = sys._getframe(1)
  24.     co = fr.f_code
  25.     filename = co.co_filename
  26.     dir = filename[:filename.rfind(os.sep)]
  27.     if os.path.exists(dir + '/Makefile.am'):
  28.         plugindir = dir[:dir.rfind(os.sep)]
  29.         icondir = plugindir + iconpath
  30.         theme.append_search_path(icondir)
  31.     
  32.  
  33.  
  34. def show_uri(uri):
  35.     if hasattr(gtk, 'show_uri'):
  36.         gtk.show_uri(gtk.gdk.Screen(), uri, 0)
  37.     else:
  38.         import gnomevfs
  39.         gnomevfs.url_show(uri)
  40.  
  41.  
  42. class _rbdebugfile:
  43.     
  44.     def __init__(self, fn):
  45.         self.fn = fn
  46.  
  47.     
  48.     def write(self, str):
  49.         if str == '\n':
  50.             return None
  51.         import rb
  52.         fr = sys._getframe(1)
  53.         co = fr.f_code
  54.         filename = co.co_filename
  55.         cwd = os.getcwd()
  56.         if cwd[-1] != os.sep:
  57.             cwd += os.sep
  58.         
  59.         if filename[:len(cwd)] == cwd:
  60.             filename = filename[len(cwd):]
  61.         
  62.         methodname = co.co_name
  63.         if fr.f_locals.has_key('self'):
  64.             methodname = '%s.%s' % (fr.f_locals['self'].__class__.__name__, methodname)
  65.         
  66.         rb._debug(methodname, filename, co.co_firstlineno + fr.f_lineno, True, str)
  67.  
  68.     
  69.     def close(self):
  70.         pass
  71.  
  72.     
  73.     def flush(self):
  74.         pass
  75.  
  76.     
  77.     def fileno(self):
  78.         return self.fn
  79.  
  80.     
  81.     def isatty(self):
  82.         return 0
  83.  
  84.     
  85.     def read(self, a):
  86.         return ''
  87.  
  88.     
  89.     def readline(self):
  90.         return ''
  91.  
  92.     
  93.     def readlines(self):
  94.         return []
  95.  
  96.     writelines = write
  97.     
  98.     def seek(self, a):
  99.         raise IOError, (29, 'Illegal seek')
  100.  
  101.     
  102.     def tell(self):
  103.         raise IOError, (29, 'Illegal seek')
  104.  
  105.     truncate = tell
  106.  
  107. sys.stdout = _rbdebugfile(sys.stdout.fileno())
  108.